package com.zmn.oms.services.impl.perf;

import com.zmn.oms.model.entity.perf.PerfMasterCateg;
import com.zmn.oms.model.entity.perf.PerfMasterCategQuery;
import com.zmn.oms.persistence.interfaces.perf.PerfMasterCategDao;
import com.zmn.oms.services.interfaces.perf.PerfMasterCategService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

/**
 * 工程师分类绩效(PerfMasterCateg)服务实现
 *
 * @author hankangshuai
 * @since 2020-03-06 17:29:55
 */
@Service("perfMasterCategService")
public class PerfMasterCategServiceImpl implements PerfMasterCategService {

    @Resource
    private PerfMasterCategDao perfMasterCategDao;

    /**
     * 根据主键查找
     *
     * @param perfMasterCategId 主键
     * @return 数据实体
     */
    @Override
    public PerfMasterCateg findByKey(Integer perfMasterCategId) {
        return perfMasterCategDao.findByKey(perfMasterCategId);
    }

    /**
     * 根据条件分页查找
     *
     * @param query 条件
     * @return 数据实体集
     */
    @Override
    public List<PerfMasterCateg> listPageByQuery(PerfMasterCategQuery query) {
        Integer count = this.countByQuery(query);
        query.setTotalCount(count);
        return count == 0 ? Collections.emptyList() : perfMasterCategDao.listPageByQuery(query);
    }

    /**
     * 根据条件批量查找
     *
     * @param query 条件
     * @return 数据实体集
     */
    @Override
    public List<PerfMasterCateg> listByQuery(PerfMasterCategQuery query) {
        return perfMasterCategDao.listByQuery(query);
    }

    /**
     * 根据条件计数
     *
     * @param query 条件
     * @return 计数
     */
    @Override
    public Integer countByQuery(PerfMasterCategQuery query) {
        return perfMasterCategDao.countByQuery(query);
    }

    /**
     * 根据主键更新
     *
     * @param record 包含要更新的主键及更新字段的实体
     * @return 影响行数
     */
    @Override
    public Integer updateByKey(PerfMasterCateg record) {
        return perfMasterCategDao.updateByKey(record);
    }

    /**
     * 插入
     *
     * @param record 实体
     * @return 影响行数
     */
    @Override
    public Integer insert(PerfMasterCateg record) {
        return perfMasterCategDao.insert(record);
    }
    /**
     * 批量插入
     *
     * @param list 实体集合
     * @return 影响行数
     */
    @Override
    public Integer insertBatch(List<PerfMasterCateg> list){
        return perfMasterCategDao.insertBatch(list);
    };
    /**
     * 根据主键删除
     *
     * @param perfMasterCategId 主键
     * @return 影响行数
     */
    @Override
    public Integer deleteByKey(Integer perfMasterCategId) {
        return perfMasterCategDao.deleteByKey(perfMasterCategId);
    }
}